package com.norma.macaron.service.event.listener;

import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

/**
 * @author zhangchaofeng
 * @date 2020/6/3 0003
 * @description
 */
@Slf4j
@Component
@RocketMQMessageListener(topic = "",consumerGroup = "",messageModel = MessageModel.BROADCASTING)
public class TestMQListener implements RocketMQListener<MessageExt> {

    @Override
    @SneakyThrows
    public void onMessage(MessageExt messageExt) {
        //解析消息内容
        String msgId = messageExt.getMsgId();
        String tags = messageExt.getTags();
        String keys = messageExt.getKeys();
        String body = new String(messageExt.getBody(), "UTF-8");

    }
}
